package xuanke;

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;



public class All {
	Map teacher = new HashMap();
	Map stuInfo = new HashMap();
	Map courseInfo = new HashMap();
	Map stuCourseInfo = new HashMap();
	Map course1 = new HashMap();

	public All(){
		teacher.put("1","工号：10001：老师：张老师：性别：男；");
		teacher.put("2","工号：10002；老师：王老师；性别：女；");
		teacher.put("3","工号：10003；老师：董老师；性别：女；");
		teacher.put("4","工号：10004；老师：蓝老师；性别：男；");
		teacher.put("5","工号：10005；老师：游老师；性别：男；");
		teacher.put("6","工号：10006；老师：吕老师；性别：女；");
		stuInfo.put("2021310666","学号:2021310666;姓名:小明哥;班级:大数据212");
		course1.put("1","Java；" );
		course1.put("2", "Python；");
		course1.put("3", "高等数学；");
		course1.put("4","电路与模拟电子技术；");
		course1.put("5", "线性代数；");
		course1.put("6", "大学物理；");
		courseInfo.put("1","课程地点：教101；上课时间：第1-16周，周四，10:00-11:40");
		courseInfo.put("2","课程地点：教102：上课时间：第1-16周，周一，8:00-9:40");
		courseInfo.put("3","课程地点：教103：上课时间：第1-16周，周二，8:00-9:40");
		courseInfo.put("4","课程地点：教104：上课时间：第1-16周，周三8:00-9:40");
		courseInfo.put("5","课程地点：教105：上课时间：第1-16周，周五8:00-9:40");
		courseInfo.put("6","课程地点：教106：上课时间：第1-16周，周一，13:30-15:10");

	}
//teacher	

	public void ShowTeacher(String n) {
		System.out.println(teacher.get(n));
	}
	public String teachout(String n) {
		String teachInfo = String.valueOf(teacher.get(n));
		return teachInfo;
	}
//student
    public void add(String a,String b) {
    	stuCourseInfo.put(a,b);
    }
    
	public void ShowStuInfo(String n) {
		System.out.println(stuInfo.get(String.valueOf(n)));
	}
//course1
	public String course1out(String n) {
		String CourInfo1 = String.valueOf(course1.get(n));
		return CourInfo1;
	}
//course
	public void ShowStuCourseInfo() {
		Set keys = stuCourseInfo.keySet();
		for(Object k:keys) {
			Object value = stuCourseInfo.get(k);
			System.out.println(value);
		}
	}
	public String out(String n) {
		String CourInfo = String.valueOf(courseInfo.get(n));
		return CourInfo;
	}

	public void ShowCourseInfo(String n) {
		System.out.println(courseInfo.get(n));
	}
	public void Xuanke() {
		Scanner s = new Scanner(System.in);
		int CouNum = 5;
		System.out.println("请输入正确的课程编号进行选课！(可选五门课程)");
		for(int i=1;i<=5;i++) {

			System.out.println("请输入需选课的课程编号：");
			String n = s.next();
			add(n, teachout(n) + "所授课程：" + course1out(n) + out(n));
			CouNum = CouNum-1;
			System.out.println("选课成功,你还可以选 "+CouNum+" 门课！");

		}

	}
	public void TuiKe() {
		Scanner s = new Scanner(System.in);
		System.out.println("是否需要进行退课！输入1进行退课，不需要则输入其它整数");
		int t1 = s.nextInt();
		if(t1==1) {
			System.out.println("请输入你需要退课的数量！");
			int t2 = s.nextInt();
			for(int i=1;i<=t2;i++) {
				System.out.println("请输入需要退课的正确编号进行退课!");
				String t3 = s.next();
				if(courseInfo.containsKey(t3)) {
					
					stuCourseInfo.remove(t3);
					System.out.println("退课成功");
					
				}
				else if(stuCourseInfo.size()==5) {
					System.out.println("五门课已选完！");
					break;
				}
				else {
					System.out.println("该课未在你已选的课中！");
				}

			}
		}

	}
	public void bxu() {
		Scanner s = new Scanner(System.in);
		int num = 5 - stuCourseInfo.size();
		System.out.println("因你未选完五个课，你仍可选"+num+"门课,如需进行补选请输入1，退出请输入其他数字");
        int xuan = s.nextInt();
        if(xuan==1) {
        	for(int i=1;i<=num;i++) {
        		System.out.println("请输入需补选课的课程编号：");
        		String n = s.next();
        		add(n, teachout(n) +"所授课程：" + course1out(n) + out(n));
        	}
        }
        else {
        	System.out.println("已退出");
        }
	}


}	
	
